package com.example.demo.util;

import org.springframework.data.redis.core.RedisTemplate;

import java.util.UUID;

import redis.clients.jedis.Jedis;

public class RedisUtil {


    public static void setToRedis(String key, String value) {
        Jedis jedis = new Jedis();
        //设置60000秒过期
        jedis.setex(key,60000,value);
    }

    public static String getFromRedis(String key) {
        Jedis jedis = new Jedis();
        return jedis.get(key);

    }

    public static void main(String[] args) {
            Jedis jedis = new Jedis();
            System.out.println(jedis.get("aa"));
            String token = UUID.randomUUID().toString();
            RedisUtil.setToRedis("token",token);
            System.out.println(jedis.get("token"));
    }
}
